unit ChromiumMainFrm;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.ComCtrls, Chromium4D,
  cefvcl;

type
  TfrmmkChromium = class(TForm)
    pnlContainer: TPanel;
    Panel2: TPanel;
    edtURL: TEdit;
    btnDebugger: TButton;
    Button2: TButton;
    btnGo: TButton;
    Button4: TButton;
    Button1: TButton;
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure btnDebuggerClick(Sender: TObject);
    procedure btnGoClick(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
  public
    FChromium: ISyChromiumBrowser;

  end;

implementation

{$R *.dfm}

uses System.Rtti, Chromium4D.Core, superobject;

procedure TfrmmkChromium.btnDebuggerClick(Sender: TObject);
begin
  FChromium.Debugger := not FChromium.Debugger;
end;

procedure TfrmmkChromium.btnGoClick(Sender: TObject);
begin
  FChromium.URL := edtURL.Text;
end;

procedure TfrmmkChromium.Button2Click(Sender: TObject);
begin
  FChromium := TSyChromiumLib.GetChromium.CreateBrowser(pnlContainer, edtURL.Text);
end;

procedure TfrmmkChromium.Button3Click(Sender: TObject);
begin
  FChromium := nil;
end;

procedure TfrmmkChromium.Button4Click(Sender: TObject);
begin
  Close;
end;

procedure TfrmmkChromium.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  FChromium := nil;
  Action := caFree;
end;

procedure TfrmmkChromium.FormCreate(Sender: TObject);
begin
  FChromium := TSyChromiumLib.GetChromium.CreateBrowser(pnlContainer, edtURL.Text);
end;

procedure TfrmmkChromium.FormDestroy(Sender: TObject);
begin
  FChromium := nil;
end;

procedure TfrmmkChromium.FormShow(Sender: TObject);
begin
//  FChromium.URL := edtURL.Text;
end;

end.
